 <!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>添加商品类型</title>
	<hdjs/>
	<style type="text/css">
		#area{
			margin-bottom: 50px;
		}
	</style>
</head>
<body> 
	<form method="post" class="hd-form" enctype="multipart/form-data">
	<!-- <input type="text"> -->
	<div class="wrap">
				<div class="menu_list">
					<ul>
						<li>
							<a href="{|U:'index'}">
								商品列表
							</a>
						</li>
						<li>
							<a href="javascript:;" class="action">
								添加商品
							</a>
						</li>
						<li>
							<a href="{|U:'addBrand'}">
								添加品牌
							</a>
						</li>
					</ul>
				</div>

				<div class="tab">
					<ul class="tab_menu">
						<li lab="base"><a href="javascript:;">基本信息</a></li>
						<li lab="content"><a href="javascript:;">详细信息</a></li>
						<li lab="pic"><a href="javascript:;">图片</a></li>
					</ul>
					<div class="tab_content">
						<div id="base">
							<table class="table1">
								<tr>
									<th>名称</th>
									<td><input type="text" name="gname" class="w300"></td>
								</tr>
								<tr>
									<th>属性</th>
									<td>
										<label><input type="checkbox"   name="flag[]" value="推荐">推荐</label>
										<label><input type="checkbox"   name="flag[]" value="置顶">置顶</label>
									</td>
								</tr>
								<tr>
									<th>栏目</th>
									<td>
										<input type="hidden" name="cid" value="{$category.cid}">
										{$category.cname}
									</td>
								</tr>
								<tr>
									<th>属性</th>
									<td>
										<table>
											<list from="$GoodsAttrForm" name="goodsattr">
											<tr>
												<th>{$goodsattr.attr_name}</th>
												<td>{$goodsattr.html}</td>
											</tr>
											</list>
										</table>
									</td>
								</tr>
								<tr>
									<th>规格</th>
									<td>
										<table>
											<thead>
											<tr>
											<list from="$goodsSpec" name="spec">
												<td>{$spec.attr_name}</td>
											</list>	
												<td>库存</td>
												<td>价格</td>
												<td>货号</td> 
												<td><a href="javascript:;" onclick="addStock(this)">添加（+）</a></td>
											</tr>
											</thead>
											<tbody id="tbody">
												<tr class="btn">
											<list from="$goodsSpec" name="spec">
												<td>{$spec.html}</td>
											</list>	
												<td><input type="text" name="spec[stock][]" class="w100"></td>
												<td><input type="text" name="spec[price][]" class="w100"></td>
												<td><input type="text" name="spec[goods_sn][]"  class="w100"></td>
												<td><a href="javascript:;" onclick="removeStock(this)" style="color:red;">删除（-）</a></td>
											</tr>
											</tbody>
											<script type="text/javascript">
													function addStock(obj){
														var html=$('.btn').eq(0).clone();
														$('#tbody').append(html);
													}
													function removeStock(obj){
														var index=$('.btn').index();
														if(index>0){
															$(obj).parents(".btn").remove();
														}
													}

											</script>
										</table>
									</td>
								</tr>
								<tr>
									<th>品牌名称</th>
									<td>
									<select name="bid">
										<option value="">===选择===</option>
										<list from="$brand" name='b'>
										<option value="{$b.bid}">{$b.bname}</option>
										</list>
									</select>
									</td>
								</tr> 
								<!-- ________ -->
								<tr>
									<th>价格</th>
									<td><input type="text" name="price" class="w300"></td>
								</tr>
								<tr>
									<th>库存</th>
									<td><input type="text" name="stock" class="w300"></td>
								</tr>
								<!-- <if value="!$goodsSpec"> --><!-- </if> -->
								<tr>
									<th>关键词</th>
									<td><input type="text" name="keywords" class="w300"></td>
								</tr>
								<tr>
									<th>描述</th>
									<td>
										<textarea id="area" name="description" class="w400 h100"></textarea>
									</td>
								</tr>
							</table>
						</div>
						<div id="content">
							<table class="table1">
								<tr>
									<th class="w100">内容</th>
									<td><ueditor name='body'></td>
								</tr>
								<tr>
									<th class="w100">服务</th>
									<td><input type="text" name='service'></td>
								</tr>
								<tr>
									<th class="w100">查看次数</th>
									<td><input type="text" name="click"></td>
								</tr>
								<tr>
									<th class="w100">发表时间</th>
									<td class="h150"><input type="text" id="addtime" name="addtime"></td>
								</tr>
								<script type="text/javascript">
									$('#addtime').calendar({format: 'yyyy/MM/dd HH:mm:ss'});
								</script>
							</table>
						</div>
						<div id="pic">
							<table class="table1">
								<tr>
									<th class="w100">首页图</th>
									<td ><input type="file" name="index_pic"></td>
								</tr>
								<tr>
									<th class="w100">列表图</th>
									<td ><input type="file" name="list_pic"></td>
								</tr>
								<tr>
									<th class="w100">内容页</th>
									<td >
										<ul id="button">
											<li><input  type="file" name="pic[]"><button type="button" id="but1"  class="hd-cancel">添加</button></li>
										</ul>

									</td> 
									<script type="text/javascript">
										$(function(){
											var data='<li><input type="file" name="pic[]"><button id="but" type="button"  class="hd-cancel">删除</button></li>';
											$("#but1").click(function(){
												$(this).parent().append(data);
											})
											$("#but").live('click',function(){
												$(this).parent('li').remove();
											})

										})
									</script>
								</tr>
							</table>
						</div>
					</div>

				</div>
			
	
				
				<div class='position-bottom'>
					<input type="submit" value="确定" class='hd-success'>
				</div>
	</div>
	</form>
</body>
</html>